package ochart.utils
{
	import ochart.core.PieChart;
	import ochart.elements.bars.Bar;

	public class ChartUtil
	{
		public static function isPieChart(data:Object):Boolean
		{
			if(!data)
			{
				return false;
			}
			if(!data["elements"])
			{
				return false;
			}
			for each(var element:Object in data["elements"])
			{
				if(element && element["type"] == PieChart.CLASS_NAME)
				{
					return true;
				}
			}
			return false;
		}
		
		public static function hasBar(data:Object):Boolean
		{
			if(!data)
			{
				return false;
			}
			if(!data["elements"])
			{
				return false;
			}
			for each(var element:Object in data["elements"])
			{
				if(element && element["type"] == Bar.CLASS_NAME)
				{
					return true;
				}
			}
			return false;
		}
	}
}